/**
 * Copyright (c) 快宝网络 kuaidihelp.com Co., Ltd. All Rights Reserved 禁止外泄以及用于其它的商业用途
 */

import React, { Component } from "react";
import PageHeaderLayout from "@/layouts/PageHeaderLayout";
import { Tabs } from "antd";
import styles from "../commen.less";
import CollectionRecord from "./components/CollectionRecord";
import CashBackList from "./components/CashBackList";

const { TabPane } = Tabs;

class Index extends Component {
  constructor(props) {
    super(props);
    this.state = {
      activeKey: "record",
      record:null,
      source: ""
    };
  }

  onChange = (activeKey,record,source) => {
    this.setState({
      activeKey,
      record, //回款清单页面，查看明细带过来的数据
      source
    });
  };

  render() {
    const { activeKey, record, source } = this.state;
    return (
      <PageHeaderLayout title="代收贷款管理">
        <div className={styles.main}>
          <Tabs type='card' activeKey={activeKey} onChange={this.onChange}>
            <TabPane tab="代收贷款记录" key="record">
              <CollectionRecord checkDetail={record} source={source}/>
            </TabPane>
            <TabPane tab="回款清单" key="list">
              <CashBackList onTabChange={this.onChange} />
            </TabPane>
          </Tabs>
        </div>
      </PageHeaderLayout>
    );
  }
}

export default Index;